class Mailer < ActionMailer::Base
  #Ik wil weten wanneer:
  # => er een nieuwe declaratie is geplaatst
  # => er een nieuwe storting is gedaan
  # => er een nieuwe postit is geplaatst
  # => ik teveel in de min sta
  
  FROM = 'info@huisrekening.vanutsteen.nl'
  
  def notify_about_balance( user )
    # Email header info MUST be added here
    recipients user.email
    from FROM
    subject 'Update over je huisrekening-balans'

    # Email body substitutions go here
    body :firstname => user.firstname, :lastname => user.lastname, :balans => user.balance.to_s('€ ')
  end
  
  def notify_about_postit( user, notice )
    # Email header info MUST be added here
    recipients user.email
    from FROM
    subject 'Er is een nieuw berichtje geplaatst'

    # Email body substitutions go here
    body :firstname => user.firstname, :lastname => user.lastname, :editor => notice.user.firstname
  end
  
  def notify_about_declaration( user, declaration )
    # Email header info MUST be added here
    recipients user.email
    from FROM
    subject 'Er is een nieuwe declaratie ingediend'

    # Email body substitutions go here
    body  :firstname => user.firstname, 
          :lastname => user.lastname, 
          :declaration_amount => declaration.amount.to_s('€'), 
          :declaration_payer => declaration.owner.firstname,
          :declaration_description => declaration.description
  end
  
  def notify_about_deposit( deposit )
    casher = deposit.casher
    payer = deposit.payer
    
    # Email header info MUST be added here
    recipients casher.email
    from FROM
    subject 'Er is storting gedaan'

    # Email body substitutions go here
    body :firstname => casher.firstname, :lastname => casher.lastname, :payer => payer.fullname
  end

end
